<?php 
$html = "";
$html .= "<TABLE class='table_list' width='100%' cellspacing='0' cellpadding='0'>" ;
$html .= "<tr>";
$html .= "	<th class='col_title'  width='24' style='border-left:0px;'><div style='width:24px;'> </div></th>";
$html .= "	<th class='col_title' width=''>文件名</th>";
$html .= "	<th class='col_title' width='130'><div style='width:130px;'>最后更新</div></th>";
$html .= "	<th class='col_title' width='60'><div style='width:60px;'>类型</div></th>";
$html .= "	<th class='col_title' width='66'><div style='width:66px;'>大小</div></th>";
$html .= "	<th class='col_title' width='110' style='border-right:0px;'><div style='width:110px;'>操作</div></th>";
$html .= "</tr></TABLE>";
$html .= "<div style='overflow:auto;overflow-x:hidden;height:300px;width:100%'><TABLE class='table_list' width='100%' cellspacing='0' cellpadding='0'>";

if($root != $currentPath){
	 
	$html .= "<tr class='row_0'>";
	$html .= "	<td class='col_c'><img src='./icons/folder.gif'></img></td>";
	$html .= "	<td><a href='javascript:void(0)' onclick=\"enterIn('".to_php_encoding(dirname($currentPath).'/')."')\">上级目录 ..</a></td>";
	$html .= "	<td></td>";
	$html .= "	<td></td>";
	$html .= "	<td></td>";
	$html .= "	<td></td>";
	$html .= "</tr>";
}
$order = deep_get('order',0,1);
 
$folders = find_folders($currentPath); 
$folders = order_list($folders,$order,$currentPath);
if(!empty($folders)){
	for($i=0;$i<count($folders);$i++){
		$folder = $folders[$i];
		$html .= "<tr class='row_0'>";
		$html .= "	<td class='col_c'><img src='./icons/folder_new.gif'></img></td>";
		$html .= "	<td><a href='javascript:void(0)' onclick=\"enterIn('".to_php_encoding($currentPath.$folder.'/')."')\">$folder</a></td>";
		$html .= "	<td>".date('Y-m-d H:i:s',filemtime($currentPath.$folder))."</td>";
		$html .= "	<td>目录</td>";
		$html .= "	<td>".round((filesize($currentPath.$folder)/1024),2)."KB</td>";
		$html .= "	<td>
					<a href='javascript:void(0)' onclick='editFile(this)'>[重命名]</a>
					<a href='javascript:void(0)' onclick='deleteFile(this)'>[删除]</a>
					</td>";
		$html .= "</tr>";
	}
}

$files = find_files($currentPath,$accept_types,false);
$files = order_list($files,$order);
 
if(!empty($files)){
	for($i=0;$i<count($files);$i++){
		$file = $files[$i];
		$base_name = get_base_name($file);
		$file_name = to_php_encoding($base_name) ;
		$file_type = get_file_type($file_name);
		$icon_file = realpath("./icons/$file_type" . ".gif");
		// print_html($icon_file);

		$relative_path = $src_path . to_linux_path(str_replace($root,"",$file));
		

		$icon = "/p5/explorer/icons/unknowFile.gif";
		if(file_exists($icon_file)){
			$icon = "/p5/explorer/icons/".$file_type.".gif";
		}

		$html .= "<tr class='row_0' title='点击预览' onclick=\"previewFile('$relative_path')\">";
		$html .= "	<td class='col_c' width='24'><div style='width:24px;'><img src='$icon'></img></div></td>";
		$html .= "	<td width=''><a href='#' onclick=\"choosed_file('$relative_path')\">$file_name</a></td>";
		$html .= "	<td width='130'>".date('Y-m-d H:i:s',filemtime($file))."</td>";
		$html .= "	<td width='60'>$file_type</div></td>";
		$html .= "	<td width='66'>".round((filesize($file)/1024),2)."KB</td>";
		$html .= "	<td width='110'> 
					<a href='javascript:void(0)' onclick='editFile(this)'>[修改]</a>
					<a href='javascript:void(0)' onclick='deleteFile(this)'>[删除]</a> 
					</td>";
		$html .= "</tr>";
	}
}

$html .= "</table></div>";
print $html ;